<%@page import="cn.com.api.entity.ApiType"%>
<%@page import="java.util.List"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />

<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>商品管理</title>
</head>
<body>

	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>商品列表

		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height: 1.6em; margin-top: 3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a> <a
			class="btn btn-primary radius r  mr-20" style="margin-top: 3px"
			onclick="goods_add('添加产品','<%=path%>/backstage/goods-add-pre?isZiYing=${isZiYing}')"
			href="javascript:;"> <i class="Hui-iconfont">&#xe600;</i> 添加商品
		</a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray">
			<form action="<%=path%>/backstage/goods-search" method="get" class="form form-horizontal" id="search-form"	onsubmit="beforSubmit()">
				<div class="text-c">
					<div class="row cl">
						<label class="form-label col-1">商品名称或ID：</label>
						<div class="formControls col-2">
							<input type="text" name="name" value="${conditions.name}"
								id="name" placeholder="商品名称或ID" class="input-text col-2">
						</div>
						<label class="form-label col-1">所属品类：</label>
						<div class="formControls col-2">
							<span class="select-box"> <select class="select"
								name="type1" id="type1" onchange="firstChange(this);">
									<option value="-1">--大类--</option>
									<c:forEach items="${types1}" var="type">
										<option value="${type.cCode}"
											<c:if test="${type.cCode==conditions.type1}">selected</c:if>>${type.cName}</option>
									</c:forEach>
							</select>
							</span>
						</div>
					
						<div class="formControls col-2">
							<span class="select-box"> <select class="select"
								name="type2" id="type2" onchange="secondChange(this);">
									<option value="-1">--中类--</option>
									<c:forEach items="${types2}" var="type">
										<option value="${type.cCode}"
											<c:if test="${type.cCode==conditions.type2}">selected</c:if>>${type.cName}</option>
									</c:forEach>
							</select>
							</span>
						</div>
						<div class="formControls col-2">
							<span class="select-box"> <select class="select"
								name="type3" id="type3">
									<option value="-1">--小类--</option>
									<c:forEach items="${types3}" var="type">
										<option value="${type.cCode}"
											<c:if test="${type.cCode==conditions.type3}">selected</c:if>>${type.cName}</option>
									</c:forEach>
							</select>
							</span>
						</div>
					</div>
					<div class="mt-10"></div>

					<input type="hidden" name="type" id="endType"
						value="${conditions.type}"> <label
						class="form-label col-1">所属商店：</label>
					<div class="formControls col-2">
						<span class="select-box"> <select class="select"
							id="shopId" name="shopId">
								<option value="-1">--所属商店--</option>
								<c:forEach items="${shops}" var="shop">
									<option value="${shop.cId}"
										<c:if test="${shop.cId==conditions.shopId}">selected</c:if>>${shop.cSname}</option>
								</c:forEach>
						</select>
						</span>
					</div>

					<label class="form-label col-1">是否删除 :</label>
				<div class="formControls col-2"> 
				<select name="is_deleted" class="select">
					<option value="-1">--是否删除--</option>
					<option value="0" <c:if test="${conditions.is_deleted==0}">selected</c:if>>未删除</option>
					<option value="1" <c:if test="${conditions.is_deleted==1}">selected</c:if>>已删除</option>
				</select>
				</div>

				<label class="form-label col-1">状态 :</label>
				<div class="formControls col-2">
					<span class="select-box"> <select name="status"
						class="select">
							<option value="-1">--状态--</option>
							<option value="0"
								<c:if test="${conditions.status==0}">selected</c:if>>未发布</option>
							<option value="1"
								<c:if test="${conditions.status==1}">selected</c:if>>出售中</option>
							<option value="2"
								<c:if test="${conditions.status==2}">selected</c:if>>已下架</option>
					</select>
					</span>
				</div>
               </form>
				<div class="row cl">
					<button name="" id="" class="btn btn-success"
						style="border-radius: 5px; float: right;" type="submit">
						查询</button>
					<div style="width: 10px; height: 5px; float: right;"></div>
					<button name="" onclick="theReset();" id="" class="btn btn-success"
						style="border-radius: 5px; float: right;">重置</button>
				</div>
		</div>
		<input type="hidden" id="isZiYing" name="isZiYing" value="${isZiYing}">
	</div>


	<div class="mt-20">
		<button class="btn btn-success radius" id="batchBtn"
			onclick="batchOutGoods(2);">批量下架</button>
		<button class="btn btn-success radius" id="batchBtn2"
			onclick="batchOutGoods(1);">批量上架</button>
		<table
			class="table table-border table-bordered table-hover table-bg table-sort">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" name="" value=""></th>
					<th width="40">ID</th>
					<th>名称</th>
					<th>缩略图</th>
					<th>所属分类</th>
					<th width="40">排序</th>
					<th width="80">产地</th>
					<!-- <th width="80">已售数量</th> -->
					<th>所在县市</th>
					<th>所属商家</th>
					<th>是否删除</th>
					<th>状态</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${goods_list}" var="goods">
					<tr class="text-c">
						<td><input type="checkbox" value="${goods.id}"
							name="goodsIds"><input type="hidden" id="id" name="id" value='${goods.id}' /></td>
						<td>${goods.id}</td>
						<td>${goods.name}</td>
						<td><img src="<%=imagePath%>${goods.image}" height="30"
							border="0" /></td>
						<td><c:forEach items="${types}" var="type">
								<c:if test="${type.cCode==goods.type}">
									${type.cName}
								</c:if>
							</c:forEach></td>
						<td>${goods.sort}</td>
						<td>${goods.producing_area}</td>
						<td>${goods.count}</td>
						<td><c:forEach items="${citys}" var="city">
								<c:if test="${city.id==goods.city_id}">
									${city.name}
								</c:if>
							</c:forEach></td>

						<td><c:forEach items="${shops}" var="shop">
								<c:if test="${shop.cId==goods.shop_id}">
										${shop.cSname}
									</c:if>
							</c:forEach></td>
						<%-- <td><c:choose>
								<c:when test="${1!=goods.is_deleted}">
									<span class="label label-success radius">有效</span>
								</c:when>
								<c:otherwise>
									<span class="label label-warning  radius">已删除</span>
								</c:otherwise>
							</c:choose></td> --%>
						<td><c:choose>
								<c:when test="${goods.status==1}">
									<span class="label label-success radius">出售中</span>
								</c:when>
								<c:when test="${goods.status==2}">
									<span class="label label-primary radius">已下架</span>
								</c:when>
								<c:when test="${goods.status==0}">
									<span class="label label-warning radius">未发布</span>
								</c:when>
								<c:otherwise>
									<span class="label label-disabled  radius">未知</span>
								</c:otherwise>
							</c:choose></td>
						<td class="td-manage"><a style="text-decoration: none"
							onClick="goods_edit(this,'${goods.id}')" href="javascript:;"
							title="编辑">编辑</a> &nbsp;&nbsp;&nbsp;&nbsp; <c:if
								test="${1 != goods.is_deleted}">
								<a style="text-decoration: none"
									onClick="goods_disable(this,'${goods.id}')" href="javascript:;"
									title="删除">删除</a>
							</c:if></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div id="Pagination" class="page-con"></div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	
	<script type="text/javascript">
	
		var showCount = ${pageInfo.showCount};
		var currentPage = ${pageInfo.currentPage-1};
		var totalResult = ${pageInfo.totalResult};
		var base_path = "<%=path%>";
	</script>
	<script type="text/javascript" src="js/good_list.js"></script>
	
</body>
</html>